package com.cy.sca.controller;

import com.cy.sca.pojo.Order;
import com.cy.sca.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private IOrderService iOrderService;

    @GetMapping("/get/{serial}")
    public Order getOrderBySerial(@PathVariable("serial") String serial) {
        return iOrderService.queryOrderBySerial(serial);
    }

    @GetMapping("/list")
    public List<Order> listOrder() {
        return iOrderService.listOrder();
    }

    @PostMapping("/add")
    public boolean addOrder(Order order) {
        return iOrderService.addOrder(order);
    }


}
